// meny 配置
import request from '@/utils/request'

const api = {
  menu: '/system/sysMenu'
}

export default api

export function getSysMenuAll(parameter) {
    return request({
      url: api.menu + '/getSysMenuAll',
      method: 'get',
      params: parameter
    })
  }
  export function saveMenu (parameter) {
      if(parameter.id > 0){
          return modifyMenu(parameter)
      } else {
          return addMenu(parameter)
      }
  }
  function addMenu(parameter){
    return request({
        url: api.menu +'/saveSysMenu',
        method: 'post',
        data: parameter,
        headers: {
          'Content-Type': 'application/json;charset=UTF-8'
        }
      })
  }
  function modifyMenu(parameter){
    return request({
        url: api.menu +'/modifySysMenu',
        method: 'put',
        data: parameter,
        headers: {
          'Content-Type': 'application/json;charset=UTF-8'
        }
      })
  }
  export function delMenu (parameter) {
    return request({
      url: api.menu + '/removeSysMenu',
      method: 'delete',
      params: parameter
    })
  }